<template>
  <!-- 单条主变的业务流程 -->
  <div>
    <div class="topTitle">
      <div class="left">
        <div class="small one">
          <div class="img">
          </div>
          <div class="text">
            {{ requestParams.dev_name }}
          </div>
        </div>

        <div class="small one">
          <div>
            越限量:
          </div>
          <div class="num">
            {{ YXL }}
          </div>
        </div>
        <div class="small one">
          <div>
            最大值:
          </div>
          <div class="num">
            {{ requestParams.dev_p }}
          </div>
        </div>
        <div class="small one">
          <div>
            限值:
          </div>
          <div class="num">
            {{ requestParams.dev_se }}
          </div>
        </div>

        <div class="small one">
          <div>
            门槛:
          </div>
          <div class="num">
            {{ MENKAN }}
          </div>
        </div>


        <div class="small one " style="width: 380px;">
          <div>
            负载率:
          </div>
          <div>
            :<el-progress :percentage="requestParams.dev_rate" status="exception" :color="requestParams.dev_rate >= 100
              ? '#ed4646'
              : requestParams.dev_rate >= 85 && requestParams.dev_rate < 100
                ? '#d3ba58'
                : '#d3ba58'
              "></el-progress>
          </div>
          <div style="color: red; " class="num">
            {{ requestParams.dev_rate }}%
          </div>
        </div>
      </div>
      <div class="right">
        {{ requestParams.over_time }}
      </div>
    </div>

    
    <div class="sortBox">
      <div class="sortType">
        <div>
          <img src="./busBkimg/endAd.png" alt=""><span> 已调节</span>
        </div>
        <div>
          <img src="./busBkimg/unAd.png" alt=""><span> 未开始</span>
        </div>

      </div>
      <div style="width: 514px;" class="imgBox">
        <img src="./busBkimg/yl.png" alt="">
        <div>
          源类措施
        </div>
      </div>
      <div style="width: 255px;" class="imgBox">
        <img src="./busBkimg/wl.png" alt="">
        <div>
          网类措施
        </div>
      </div>
      <div style="width: 755px;" class="imgBox">
        <img src="./busBkimg/hl.png" alt="">
        <div>
          荷类措施
        </div>
      </div>
      <div style="width: 255px;" class="imgBox">
        <img src="./busBkimg/cl.png" alt="">
        <div>
          储类措施
        </div>
      </div>
    </div>

    <div class="contentBox">
      <div class="leftBox">
        <div class="litt littleBox">
          <div>
            <div>地</div>
            <div style="margin-top: 5px;">调</div>
          </div>

        </div>
        <div class="litt littleBox2">
          <div>
            <div>省</div>
            <div style="margin-top: 5px;">调</div>
          </div>

        </div>
        <div class="litt littleBox3">
          <div>
            <div>县</div>
            <div style="margin-top: 5px;">调</div>
          </div>

        </div>
      </div>
      <div class="centerBox">

        <div class="smallOne">

          <div class="titBox">
            统调小机组压降
          </div>
          <div v-if="sdxData[0].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>

          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[0].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[0].anpai }}
            </div>

          </div>
          <div class="arraybox2"></div>

          <div class="dataBox">
            <div class="xvqiu">
              省调校核状态
            </div>
            <div class="statePass">
              {{ sdxData[0].PassState == 1 ? '通过' : '未校核' }}
            </div>
            <div class="xvqiu">
              省调校核后调节量
            </div>
            <div class="underNum">
              {{ sdxData[0].tjl }}
            </div>

          </div>
        </div>

        <div class="smallOne">
          <div class="titBox">
            非统调常规机组压降
          </div>
          <div v-if="sdxData[1].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[1].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[1].anpai }}
            </div>
          </div>
        </div>

        <div class="smallOne">

          <div class="titBox">
            方式调整
          </div>
          <!-- <div class="bollBox">
          </div> -->
          <!-- <div v-if="sdxData[2].PassState == 1 " class="bollBox">
          </div> -->
          <div  class="bollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[2].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[2].anpai }}
            </div>

          </div>
          <div class="arrayLong"></div>
          <div class="dataBox">
            <div class="xvqiu">
              县调校核状态
            </div>
            <div class="statePass_di">
            </div>
            <div class="xvqiu">
              县调校核后调节量
            </div>
            <div class="underNum">
              {{ sdxData[2].anpai }}
            </div>

          </div>
        </div>

        <div class="smallOne">
          <div class="titBox">
            可调负荷
          </div>
          <div v-if="sdxData[3].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[3].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[3].anpai }}
            </div>

          </div>
          <div class="arrayboxNull"></div>
          <div class="dataBox">
            <div class="xvqiu">
              省调校核状态
            </div>
            <div class="statePass">
              {{ sdxData[3].PassState == 1 ? '通过' : '未校核' }}
            </div>
            <div class="xvqiu">
              省调校核后调节量
            </div>
            <div class="underNum">
              {{ sdxData[3].anpai }}
            </div>

          </div>
        </div>

        <div class="smallOne">

          <div class="titBox">
            虚拟电厂
          </div>
          <div v-if="sdxData[3].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[4].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[4].anpai }}
            </div>

          </div>
          <div class="arraybox2"></div>

          <div class="dataBox">
            <div class="xvqiu">
              省调校核状态
            </div>
            <div class="statePass">
              {{ sdxData[4].PassState == 1 ? '通过' : '未校核' }}
            </div>
            <div class="xvqiu">
              省调校核后调节量
            </div>
            <div class="underNum">
              {{ sdxData[4].tjl }}
            </div>

          </div>
        </div>

        <div class="smallOne">

          <div class="titBox">
            微电网
          </div>
          <div v-if="sdxData[5].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[5].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[5].anpai }}
            </div>

          </div>
        </div>

        <div class="smallOne">

          <div class="titBox">
            储能调峰
          </div>
          <div v-if="sdxData[6].PassState == 1 " class="bollBox">
          </div>
          <div v-else class="GreybollBox">
          </div>
          <div class="arraybox">
          </div>

          <div class="dataBox">
            <div class="xvqiu">
              调节需求
            </div>
            <div class="dataSmall">
              {{ sdxData[6].xvqiu }}
            </div>
            <div class="xvqiu">
              日前安排
            </div>
            <div class="dataSmall dataSmall_rq">
              {{ sdxData[6].anpai }}
            </div>

          </div>
          <div class="arraybox2"></div>

          <div class="dataBox">
            <div class="xvqiu">
              省调校核状态
            </div>
            <div class="statePass">
              {{ sdxData[6].PassState == 1 ? '通过' : '未校核' }}
            </div>
            <div class="xvqiu">
              省调校核后调节量
            </div>
            <div class="underNum">
              {{ sdxData[6].anpai }}
            </div>

          </div>
        </div>

      </div>
    </div>


  </div>
</template>

<script>
import {

  dtyx_adjustmentStrategy,

} from "@/api/index";
export default {


  data() {
    return {
      myName_zi: '',
      resouse_Message: {},
      requestParams: {
        dev_id: '',
        dev_name: '',
        dev_p: '',
        dev_se: '',
        dev_rate: '',
        over_type: '',
        over_time: '',
      },
      YXL: 0,
      MENKAN:'0',
      


      sdxData: [
        {
          name: '统调小机组压降',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '非统调常规机组压降',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '方式调整',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '可调负荷',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '虚拟电厂',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '微电网',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
        {
          name: '储能调峰',
          xvqiu: '',
          anpai: '',
          tjl: '',
          PassState: '',
        },
      ]


    }
  },
  created() {

    this.MENKAN = sessionStorage.getItem('MENKAN')

    this.myName_zi = sessionStorage.getItem('Name_zi')
    this.resouse_Message = sessionStorage.getItem('resouse_Message')
    console.log(this.resouse_Message, '看信息')

    this.requestParams = JSON.parse(sessionStorage.getItem('resouse_Message'))
    this.YXL = sessionStorage.getItem('YXL_XE0')
    this.requestParams.dev_p = Number(this.requestParams.dev_p).toFixed(2)
    this.requestParams.dev_rate = Number(this.requestParams.dev_rate).toFixed(2)
    this.requestParams.dev_se = Number(this.requestParams.dev_se).toFixed(2)
    console.log(this.requestParams, '看一眼数据')

    // alert(this.requestParams.over_time.slice(11,15), '9999' )
    // 调用接口
    this.useMydtyx_adjustmentStrategy()
  },
  methods: {
    useMydtyx_adjustmentStrategy() {
      let params = {
        id: this.requestParams.dev_id,
        time:this.requestParams.over_time.slice(11,16),
        day:this.requestParams.over_time.slice(0,10),
      }

      dtyx_adjustmentStrategy(params).then(res => {
        if (res.code !== 200) return

        this.sdxData.forEach(it => {
          if (it.name == '统调小机组压降') {
            it.xvqiu = res.data.tracking.requirement.toFixed(2)
            it.anpai = res.data.tracking.arranged.toFixed(2)
            it.tjl = res.data.tracking.arranged.toFixed(2)
            it.PassState = res.data.tracking.status
          } else if (it.name == '非统调常规机组压降') {
            it.xvqiu = res.data.notTracking.requirement.toFixed(2)
            it.anpai = res.data.notTracking.arranged.toFixed(2)
            it.tjl = res.data.notTracking.arranged.toFixed(2)
            it.PassState = res.data.notTracking.status
          }else if(it.name == '方式调整'){
            it.xvqiu = res.data.load.requirement.toFixed(2)
            it.anpai = res.data.load.arranged.toFixed(2)
            it.tjl = res.data.load.arranged.toFixed(2)
            it.PassState = res.data.load.status
          }else if(it.name == '可调负荷'){
            it.xvqiu = res.data.adjustLoad.requirement.toFixed(2)
            it.anpai = res.data.adjustLoad.arranged.toFixed(2)
            it.tjl = res.data.adjustLoad.arranged.toFixed(2)
            it.PassState = res.data.adjustLoad.status
          }else if(it.name == '虚拟电厂'){
            it.xvqiu = res.data.virtualGrid.requirement.toFixed(2)
            it.anpai = res.data.virtualGrid.arranged.toFixed(2)
            it.tjl = res.data.virtualGrid.arranged.toFixed(2)
            it.PassState = res.data.virtualGrid.status
          }else if(it.name == '微电网'){
            it.xvqiu = res.data.microGrid.requirement.toFixed(2)
            it.anpai = res.data.microGrid.arranged.toFixed(2)
            it.tjl = res.data.microGrid.arranged.toFixed(2)
            it.PassState = res.data.microGrid.status
          }else if(it.name == '储能调峰'){
            it.xvqiu = res.data.cn.requirement.toFixed(2)
            it.anpai = res.data.cn.arranged.toFixed(2)
            it.tjl = res.data.cn.arranged.toFixed(2)
            it.PassState = res.data.cn.status
          }
        })
      })
    }
  },
}

</script>
<style lang="scss" scoped>
::v-deep .el-icon-circle-close {
  display: none;
}

::v-deep .el-progress {
  width: 190px;
}

::v-deep .el-progress-bar__outer {
  background: rgba(128, 128, 128, 0.186) !important;
}

::v-deep .el-progress-bar {
  width: 100%;
  margin-bottom: 15px;
}

.topTitle {
  width: 1834px;
  height: 44px;
  background: url(./busBkimg/h.png) no-repeat;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
  justify-content: space-between;

  .left {

    display: flex;
    align-items: center;

    .small {
      display: flex;
      align-items: center;
      height: 44px;
      width: 180px;

      .img {
        background: url(./busBkimg/tree.png);
        width: 20px;
        height: 19px;
      }

      .text {
        color: red;
      }

      .num {
        padding-top: 2px;
        box-sizing: border-box;
        color: #4d9e98;
        height: 44px;
        line-height: 44px;
      }
    }
  }

}

.sortBox {

  width: 1795px;
  height: 125px;
  margin: 10px auto 0;
  background: url(./busBkimg/lineColor.png) no-repeat center bottom;
  display: flex;

  .sortType {
    position: absolute;
    right: 50px;
    top: 250px;
    font-size: 12px;
  }

  .imgBox {
    width: 92px;
    height: 100%;
    text-align: center;
    font-weight: 600;

  }

}

.contentBox {
  width: 100%;
  height: 730px;
  margin-top: 10px;
  display: flex;

  .centerBox {
    width: 1795px;
    height: 100%;
    background: url(./busBkimg/1795.png) no-repeat;
    padding-top: 18px;
    box-sizing: border-box;
  }

  .leftBox {
    width: calc((100% - 1795px)/ 2);
    height: 100%;



    .litt {
      height: 160px;
      background: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
    }

    .littleBox {
      margin-top: 100px;
      background: url(./busBkimg/dd.png)no-repeat center;
    }

    .littleBox2 {
      background: url(./busBkimg/sd.png) no-repeat center;
      margin-top: 100px;

    }

    .littleBox3 {
      background: url(./busBkimg/xd.png)no-repeat center;
      margin-top: 20px;

    }
  }
}

.centerBox {
  display: flex;

  .smallOne {
    height: 100%;
    width: 260px;
    border-right: 1px dashed #4d9e98;

    .titBox {
      margin: 0 auto;
      width: 176px;
      height: 46px;
      text-align: center;
      line-height: 46px;
      background: url(./busBkimg/titK.png) no-repeat center;
    }

    .bollBox {
      width: 28px;
      height: 28px;
      margin: auto;
      background: url(./busBkimg/greenBall.png) no-repeat center;
      animation: fadeInOut 1.5s infinite;
    }

    @keyframes fadeInOut {
      0% {
        opacity: 0.5;
      }

      50% {
        opacity: 1;
      }

      100% {
        opacity: 0.5;
      }

    }

    .GreybollBox {
      width: 28px;
      height: 28px;
      margin: auto;
      background: url(./busBkimg/greyBall.png) no-repeat center;
    }

    .arraybox {
      width: 56px;
      height: 20px;
      margin: auto;
      background: url(./busBkimg/stateGreen.png) no-repeat center;
    }

    .dataBox {
      width: 151px;
      height: 170px;
      margin: 0 auto;
      background: url(./busBkimg/dataBig.png) no-repeat;
      overflow: hidden;

      .xvqiu {
        background: url(./busBkimg/titleDi.png) no-repeat center bottom;
        margin: 0 auto;
        width: 100%;
        height: 20px;

        margin-top: 15px;
        font-size: 14px;
        text-indent: 16px;
        text-align: center;
      }

      .dataSmall {
        background: url(./busBkimg/dataSmll.png) no-repeat center bottom;
        margin: 0 auto;
        width: 112px;
        height: 30px;
        font-weight: 600;
        margin-top: 5px;
        text-align: center;
        line-height: 30px;
        color: #4d9e98;
      }

      .dataSmall_rq {
        color: #087fc1;
      }

      .statePass {
        width: 60px;
        height: 24px;
        background: url(./busBkimg/statePass.png);
        margin: auto;
        text-align: center;
        line-height: 24px;
        font-size: 14px;
        color: #4d9e98;
        margin-top: 8px;

      }

      .statePass_di {
        width: 33px;
        height: 33px;
        margin: 10px auto 0px;

        background: url(./busBkimg/wanC.png);


      }

      .underNum {
        width: 100%;
        text-align: center;
        color: #087fc1;
        margin-top: 10px;
        font-weight: 600;
      }


    }

    .arraybox2 {
      margin: 0 auto;
      width: 38px;
      height: 68px;
      background: url(./busBkimg/shuangArray.png)
    }

    .arrayboxNull {
      margin: 0 auto;
      width: 38px;
      height: 68px;
    }


    .arrayLong {
      margin: auto;
      width: 15px;
      height: 257px;
      background: url(./busBkimg/arrayLong.png) no-repeat;
    }
  }
}
</style>